home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / vtskt10i.zip / SERVER.FRM < prev    next >
Text File  |  1993-12-26  |  2KB  |  103 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "VTSocket Server"
  4.    ClientHeight    =   1920
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1470
  7.    ClientWidth     =   5295
  8.    Height          =   2325
  9.    Left            =   1035
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1920
  12.    ScaleWidth      =   5295
  13.    Top             =   1125
  14.    Width           =   5415
  15.    Begin WinSock WinSock1 
  16.       Client_or_Server=   1  'Server
  17.       Index           =   0
  18.       Interval        =   0
  19.       IPName          =   ""
  20.       Left            =   4440
  21.       LicDate         =   0
  22.       License1        =   ""
  23.       License2        =   ""
  24.       Licensed        =   0
  25.       Linger          =   0   'False
  26.       Port            =   0
  27.       RecvBufSize     =   0
  28.       SendBufSize     =   0
  29.       Top             =   1230
  30.    End
  31.    Begin CommandButton listen 
  32.       Caption         =   "Listen"
  33.       Height          =   435
  34.       Left            =   4140
  35.       TabIndex        =   1
  36.       Top             =   660
  37.       Width           =   1095
  38.    End
  39.    Begin ListBox List1 
  40.       Height          =   1785
  41.       Left            =   60
  42.       TabIndex        =   0
  43.       Top             =   60
  44.       Width           =   3975
  45.    End
  46. End
  47. Dim cnt As Integer
  48.  
  49. Sub Form_Load ()
  50.  
  51. MsgBox winsock1(0).Description
  52.  
  53. End Sub
  54.  
  55. Sub Form_Unload (Cancel As Integer)
  56.  
  57. If winsock1(0).Open Then
  58.   winsock1(0).Open = False
  59. End If
  60.  
  61. End Sub
  62.  
  63. Sub listen_Click ()
  64.  
  65. winsock1(0).Port = 23
  66. winsock1(0).Open = True
  67. cnt = cnt + 1
  68. list1.AddItem Format$(cnt, "###") + " Listening on port " + Str$(winsock1(0).Port), 0
  69.  
  70. End Sub
  71.  
  72. Sub WinSock1_Connect (index As Integer, ID As Integer)
  73.  
  74. cnt = cnt + 1
  75. list1.AddItem Format$(cnt, "###") + " Connected on socket " + Str$(ID), 0
  76. Load winsock1(ID)
  77.  
  78. End Sub
  79.  
  80. Sub WinSock1_Disconnect (index As Integer)
  81.  
  82. cnt = cnt + 1
  83. list1.AddItem Format$(cnt, "###") + " Disconnect on socket " + Str$(index), 0
  84. If index > 0 Then
  85.   Unload winsock1(index)
  86. Else
  87.   MsgBox ("Close received for listening socket, terminating")
  88.   End
  89. End If
  90.  
  91. End Sub
  92.  
  93. Sub WinSock1_Recv (index As Integer)
  94.  
  95. cnt = cnt + 1
  96. list1.AddItem Format$(cnt, "###") + " RECV: '" + winsock1(index).Recv + "' from socket=" + Str$(index), 0
  97. cnt = cnt + 1
  98. list1.AddItem Format$(cnt, "###") + " SEND: Hi there!! in response", 0
  99. winsock1(index).Send = "Hi there!!"
  100.  
  101. End Sub
  102.  
  103.